import { defineConfig } from 'vitepress'

import UnoCSS from 'unocss/vite'

import VueDevTools from 'vite-plugin-vue-devtools';

const description = '抖店,拼多多,拼夕夕,淘宝,京东,电商多平台多店铺管理'

export default defineConfig({
  title: "多店通",
  lang: 'zh-CN',  
  head: [
    ['link', { rel: 'icon', href: '/favicon.ico' }],
    ['meta', { name: 'keywords', content: description }],
    ['meta', { name: 'description', content: description }],
    ['meta', { property: 'og:locale', content: 'zh_CN' }], // Open Graph 协议语言设置
    ['meta', { name: 'language', content: 'Chinese' }] // 文档语言设置
  ],
  description,
  appearance: true,
  cleanUrls: true,
  lastUpdated: true,
  markdown: {
    image: {
      lazyLoading: true
    }
  },
  sitemap: {
    hostname: 'https://duodiantong.cn'
  },
  themeConfig: {
    logo: { src: '/logo.png', alt: description },
    search: {
      provider: 'local',
      options: {
        translations: {
          button: {
            buttonText: '搜索文档',
            buttonAriaLabel: '搜索文档'
          },
          modal: {
            noResultsText: '无法找到相关结果',
            resetButtonTitle: '清除查询条件',
            footer: {
              selectText: '选择',
              navigateText: '切换',
              selectKeyAriaLabel: '选择当前搜索结果',
              navigateUpKeyAriaLabel: '向上导航搜索结果',
              navigateDownKeyAriaLabel: '向下导航搜索结果',
              closeText: '关闭',
              closeKeyAriaLabel: '关闭搜索框'
            }
          }
        },
      }
    },
    siteTitle: "多店通",
    nav: [
      { text: '使用教程', link: '/app/cookbook/' },
      { text: '功能演示', link: '/app/functions/' },
      {
        text: '电商运营教程',
        items: [
          { text: '小抖运营', link: '/school/dy/' },
          { text: '夕夕运营', link: '/school/pdd/' },
          { text: '淘运营', link: '/school/tb/' },
          { text: '东运营', link: '/school/jd/' },
          { text: '蝴蝶号', link: '/school/wxxd/' },
        ]
      },
      {
        text: `v1.0.0`, items: [
          {
            component: 'RainbowAnimationSwitcher',
            props: {
              text: '彩虹动画',
            },
          },
        ]
      },
      {
        component: 'userInfo'
      }
    ],
    footer: {
      message: '多店通版权所有',
      copyright: 'Copyright © 2025 多店通 <a href="https://beian.miit.gov.cn/" target="_blank">浙ICP备2025182429号-1</a>'
    },
    sidebar: {
      '/app/': [
        {
          text: '介绍',
          items: [
            { text: '多店通是什么?', link: '/app/introduction/' },
            { text: '安装教程', link: '/app/introduction/install' },
            { text: '定价', link: '/app/introduction/price' },
            { text: '商务合作', link: '/app/introduction/cooperation' }
          ]
        },
        {
          text: '使用教程',
          items: [
            { text: '目录', link: '/app/cookbook/' },
            { text: '登录教程', link: '/app/cookbook/goods' },
            { text: '多店铺管理', link: '/app/cookbook/shopmanage' },
            { text: 'ROI计算器', link: '/app/cookbook/finance' },
            { text: '单品直降', link: '/app/cookbook/specialoffer' },
          ]
        },
        {
          text: '功能演示',
          items: [
            { text: '目录', link: '/app/functions/' },
            { text: '商品管理', link: '/app/functions/goods' },
            { text: '订单管理', link: '/app/functions/order' },
            { text: '营销活动', link: '/app/functions/marketing' }
          ]
        }
      ],
      '/school/dy/': [
        {
          text: '小抖运营',
          items: [
            { text: '目录', link: '/school/dy/' },
            { text: '小抖基础知识', link: '/school/dy/basic' },
            { text: '小抖运营技巧', link: '/school/dy/skills' },
            { text: '小抖数据分析', link: '/school/dy/data' }
          ] 
        }
      ],
      '/school/pdd/': [
        {
          text: '夕夕运营',
          items: [
            { text: '目录', link: '/school/pdd/' },
            { text: '夕夕基础知识', link: '/school/pdd/basic' },
            { text: '夕夕运营技巧', link: '/school/pdd/skills' },
            { text: '夕夕数据分析', link: '/school/pdd/data' }
          ]
        }
      ],
      '/school/tb/': [ 
        {
          text: '淘运营',
          items: [
            { text: '目录', link: '/school/tb/' },
            { text: '淘基础知识', link: '/school/tb/basic' },
            { text: '淘运营技巧', link: '/school/tb/skills' },
            { text: '淘数据分析', link: '/school/tb/data' }
          ]
        }
      ],
      '/school/jd/': [
        {
          text: '东运营',
          items: [
            { text: '目录', link: '/school/jd/' },
            { text: '东基础知识', link: '/school/jd/basic' },
            { text: '东运营技巧', link: '/school/jd/skills' },
            { text: '东数据分析', link: '/school/jd/data' }
          ]
        }
      ],
      '/school/wxxd/': [
        {
          text: '蝴蝶号',
          items: [
            { text: '目录', link: '/school/wxxd/' },
            { text: '蝴蝶号基础知识', link: '/school/wxxd/basic' },
            { text: '蝴蝶号运营技巧', link: '/school/wxxd/skills' },
            { text: '蝴蝶号数据分析', link: '/school/wxxd/data' }
          ]
        }
      ]
    },
    docFooter: {
      prev: '上一页',
      next: '下一页'
    },

    outline: {
      label: '页面导航'
    },

    lastUpdated: {
      text: '最后更新于'
    },

    notFound: {
      title: '页面未找到',
      quote:
        '但如果你不改变方向，并且继续寻找，你可能最终会到达你所前往的地方。',
      linkLabel: '前往首页',
      linkText: '带我回首页'
    },

    langMenuLabel: '多语言',
    returnToTopLabel: '回到顶部',
    sidebarMenuLabel: '菜单',
    darkModeSwitchLabel: '主题',
    lightModeSwitchTitle: '切换到浅色模式',
    darkModeSwitchTitle: '切换到深色模式',
    skipToContentLabel: '跳转到内容'
  },
  vite: {
    plugins: [
      UnoCSS() as any,
      VueDevTools()
    ],
    server: {
      // 允许指定的主机访问
      allowedHosts: ['duodiantong.cn'],
      proxy: {
        '/api': {
          target: 'http://duodiantong.cn/api',
          changeOrigin: true,
          rewrite: (path) => path.replace(/^\/api/, '')
        }
      }
    },
    resolve: {
      alias: {
        '@common': '/docs/common'
      }
    }
  },
})
